package com.jysz.certificate.persistence.model.pm;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.jysz.certificate.persistence.enums.PostType;
import com.jysz.certificate.persistence.model.system.User;
import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

/**
 * @author <a href="mailto:javaengine@outlook.com">Kaca Rich</a>
 *
 */
@Entity
@Table(name = "pm_assign_user")
@org.hibernate.annotations.Entity
public class AssignUser extends AbstractBaseEntity<Long>  {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private PAShopMonthDetail paShopMonthDetail;
	private double amount; //应发金额
	private User user;
	private String monthDate;//绩效月份

	private PostType addPost; //添加数据的岗位
	private PostType lastUpdatePost;//数据最后更新的岗位
	
	private String displayColor;//页面red,yellow 区域经理修改过金额的记录颜色为<font color="red">红色</font>，监管科修改过区域经理修改过的记录颜色为<font color="yellow">黄色</font>
	
	/** 备注*/
	private String remark;
	
	private UserPerformance userPerformance;
	
	private PostType postType; //分配给人员的岗位类型
	
	@Column(name = "_amount")
	public double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}

	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_user_id") 
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "_remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	
	@Column(name = "_monthDate", length = 7)
	public String getMonthDate() {
		return monthDate;
	}

	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "pa_shop_month_detail_id") 
	public PAShopMonthDetail getPaShopMonthDetail() {
		return paShopMonthDetail;
	}

	public void setPaShopMonthDetail(PAShopMonthDetail paShopMonthDetail) {
		this.paShopMonthDetail = paShopMonthDetail;
	}

	public void setMonthDate(String monthDate) {
		this.monthDate = monthDate;
	}
	
	@Column(name = "_add_post")
	@Enumerated(EnumType.ORDINAL)
	public PostType getAddPost() {
		return addPost;
	}

	public void setAddPost(PostType addPostType) {
		this.addPost = addPostType;
	}

	@Column(name = "_last_update_post")
	@Enumerated(EnumType.ORDINAL)
	public PostType getLastUpdatePost() {
		return lastUpdatePost;
	}

	public void setLastUpdatePost(PostType lastUpdatePost) {
		this.lastUpdatePost = lastUpdatePost;
	}

	@Column(name = "_display_color")
	public String getDisplayColor() {
		return displayColor;
	}

	public void setDisplayColor(String displayColor) {
		this.displayColor = displayColor;
	}
	
	@ManyToOne(targetEntity = UserPerformance.class, cascade=CascadeType.REFRESH)
	@JoinColumn(name="_user_performance_id", insertable=true, updatable=true) 
	public UserPerformance getUserPerformance() {
		return userPerformance;
	}

	public void setUserPerformance(UserPerformance userPerformance) {
		this.userPerformance = userPerformance;
	}
	
	@Column(name = "_post_type")
	@Enumerated(EnumType.ORDINAL)
	public PostType getPostType() {
		return postType;
	}

	public void setPostType(PostType postType) {
		this.postType = postType;
	}
	
	
}
